#include<bits/stdc++.h>
using namespace std;

int a[1000010], b[1000010];

int main()
{
	// a[i]/a[j] = b[j]/b[i] == a[i]*b[i] = a[j]*b[j]
	
	unordered_map<int, int> mp;
	int n;
	cin>>n;
	for(int i = 1;i <= n;++i)
	{
		cin>>a[i]>>b[i];
		int sum = a[i]*b[i];
		if(mp.count(sum))
			mp[sum]++;
		else
			mp[sum] = 1;
	}
		
	long long ans = 0;
	
	for(auto i = mp.begin();i != mp.end();i++)
	{
		int num = i->second;
		if(num > 1)
			ans += num*(num-1)/2;
	}
		
	cout<<ans; 
	return 0;
}

